<template>
  <div class="app">
    <el-container>
      <el-header>
        <!--logo-->
        <div class="logo_img">
          <router-link :to="{name:'Index'}">
            <img src="../../assets/weibo_logo.jpg" style="height: 50px;width: 170px" alt="首页">
          </router-link>
          <div style="float: right;width: 200px;height: 50px">
            <span>欢迎：{{this.token}} </span>&nbsp;&nbsp;
            <span><router-link style="text-decoration: none;" :to="{name:'Index'}">退出登录</router-link> </span>
          </div>
        </div>

      </el-header>
      <el-container style="">
        <el-aside  width="230px" style="height: 652px">
          <el-row  class="tac" >
            <el-col  :span="24" >
              <el-menu background-color="#545c64" text-color="#fff"  :default-active="$route.path" router style="height: 650px"  class="el-menu-vertical-demo">
                <el-menu-item index="/user">
                  <i class="el-icon-user"></i>
                  <span slot="title">用户管理</span>
                </el-menu-item>
                <el-menu-item  index="/role">
                  <i class="el-icon-coordinate"></i>
                  <span slot="title">角色管理</span>
                </el-menu-item>
                <el-menu-item index="/infor">
                  <i class="el-icon-document"></i>
                  <span slot="title">信息资讯管理</span>
                </el-menu-item>
                <el-menu-item index="/classify">
                  <i class="el-icon-coin"></i>
                  <span slot="title">信息分类管理</span>
                </el-menu-item>
              </el-menu>
            </el-col>
          </el-row>
        </el-aside>
        <el-container>
          <el-main>
            <router-view/>
          </el-main>
          <el-footer>
            copyright © 2010-today weibo.com.cn, All Rights Reserved.
          </el-footer>
        </el-container>
      </el-container>
    </el-container>

  </div>
</template>

<script>
  export default {
    name: "Admin",
    data(){
      return{
        data:{},//查询到的数据
        token:''
      }
    },
    methods:{
      /*查询所有用户*/
      findAll(id){
        let _this = this
        console.log(id)
        this.$axios.get("http://localhost:8050/user/getUserById/"+id).then(function(res){
          _this.data = res.data
          console.log(_this.data)
        }).catch(function (err) {
          alert('查询失败')
        })
      },

      findToken(){
        this.token = localStorage.getItem("admin");
      },
      exit(){
        localStorage.removeItem("admin")
        this.$router.push({name:'Index'})
      }
    },
    mounted(){
      this.findToken();
    },
  }
</script>

<style scoped>
  .el-header {
    background-color: white;
    color: #333;
    /*text-align: center;*/
    border: 1px solid rgba(238,236,237,0.94);
    line-height: 60px;
  }
  .el-footer{
    color: #333;
    background-color: #F6F6F6;
    text-align: center;
    font-size: 1px;
    line-height: 50px;
  }

  .el-aside {
    /*background-color: #D3DCE6;*/
    color: #333;
    /*text-align: center;*/
    /*line-height: 200px;*/
  }

  .el-main {
    background-color: #F6F6F6;
    color: #333;

    /*text-align: center;*/
    /*line-height: 160px;*/
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>
